/**
 * 2
 *  
 * @Author : roryrywang
 * @DateTime : 24-9-4 下午6:54
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <queue>

using namespace std;

int getSameFriendsCount(unordered_set<int> &set1, unordered_set<int> &set2) {
    int res = 0;
    for (auto u: set1) {
        if (set2.count(u)) res++;
    }
    return res;
}

int main() {
    int n, m, k, l;
    cin >> n >> m >> k >> l;
    unordered_set<int> graph[n + 1];
    vector<bool> exclude(n + 1);

    for (int i = 1; i <= m; ++i) {
        int a, b;
        cin >> a >> b;
        graph[a].insert(b);
        graph[b].insert(a);
    }
    for (int i = 1; i <= n; ++i) {
        exclude[i] = false;
    }

    exclude[k] = true;
    for (auto u: graph[k]) {
        exclude[u] = true;
    }

    auto cmp = [](pair<int, int> p1, pair<int, int> p2) {
        return p2.second == p1.second ? p1.first < p2.first : p1.second > p2.second;
    };

    priority_queue<pair<int, int>, vector<pair<int, int>>, decltype(cmp)> pq(cmp);
    for (int i = 1; i <= n; ++i) {
        if (!exclude[i]) {
            pq.emplace(i, getSameFriendsCount(graph[k], graph[i]));
            if (pq.size() > l) pq.pop();
        }
    }

    vector<pair<int, int>> vec;

    while (!pq.empty()) {
        vec.push_back(pq.top());
        pq.pop();
    }

    sort(vec.begin(), vec.end(), *cmp);

    int cnt = l;
    string res;

    for (auto u: vec) {
        res += to_string(u.first) + " ";
        cnt--;
    }

    while (cnt) {
        res += "0 ";
        cnt--;
    }

    if (!res.empty()) res = res.substr(0, res.size() - 1);

    cout << res;

    return 0;
}